<%@page import="com.kensure.shike.constant.BusiConstant"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<jsp:include page="base/header.jsp" flush="true"> 
 <jsp:param value="基本信息" name="pageTitle"/>
</jsp:include>
<style>
	.pic{width:180px;height:180px;}
</style>

<body>


<style>
.mainweb{ 
	width:100%; 
	height:100%; 
	overflow:auto; 
} 
.btop{
	position:absolute; 
	top:10px; 
	right:16px; 
	width:100px; 
	height:100px; 
}
</style>

<div class="mainweb layui-anim layui-anim-upbit">
	
	<fieldset class="layui-elem-field">
		
		<div class="layui-field-box">
		    <form id="editForm" class="layui-form" lay-filter="form">
			   
				 <div class="layui-form-item">
					<label class="layui-form-label">姓名</label>
					<div class="layui-inline">
						<input type="text" name='realname' class="layui-input" value="">
					</div>
			    </div>	
			    
			    <div class="layui-form-item">
					<label class="layui-form-label">手机号码</label>
					<div class="layui-inline">
						<input type="text" name='phone' class="layui-input" value="">
					</div>
			    </div>		 
		        
		    </form>
		 </div>
	</fieldset>		
</div>

 	<div id="dg" style="text-align:center;">
				<button id="btn1" onclick="savebaobei()" style="width:200px;"  class="layui-btn layui-btn-normal">保存</button>
	</div>

</body>




<script>
    
	var tokenid = getQueryVariable("token");
   //JavaScript代码区域，layui初始化
	layui.use(['element', 'layer', 'form', 'laydate', 'upload'], function(){
		var $ = layui.jquery;
		var element = layui.element;
		var layer = layui.layer;
		var form = layui.form;
		var laydate = layui.laydate,
			upload = layui.upload;
		
	    if(tokenid){
	    	var url = getbaseurl("/user/getuser.do");
	    	var data = {token:tokenid};
	    	postsync(url, data, function(data){
				var row = data.resultData.row;
				form.val('form',row);
				form.render();
			}, null, null);
	    }
	});
 
	
	// 保存
	function savebaobei() {
		var data = formtojson($('#editForm'));
		if(!data.realname){
			alert("请填写姓名");
			return false;
		}
		if(!data.phone){
			alert("请填写手机号码");
			return false;
		}
		
		data.nickname = data.realname;
		var url = getbaseurl("/user/updateuser.do");
		postdo(url, data, function(data){
			alert("保存成功")
			var mylay = parent.layer.getFrameIndex(window.name);
            parent.layer.close(mylay);
            window.parent.doSearch();
		}, null, null);
	}

	
     
</script>


</html>